package com.janj.Phone2Plus;

import java.sql.Connection;
import java.sql.DriverManager;

//自定义的工具类

public class JDBCUtils2 {
   static String url ;
   static String username ;
   static String password ;
   static String dirverName ;

static {
    url = "jdbc:mysql://192.168.65.47:3306/duod9";
    username = "root";
    password = "root";
    dirverName = "com.mysql.jdbc.Driver" ;
}

        public static Connection getConnection(){
            Connection conn = null;
            try {

                Class.forName(dirverName);
                conn = DriverManager.getConnection(url, username, password);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return conn ;
    }
}
